<?php

namespace App\Http\Controllers;

use Laravel\Lumen\Routing\Controller as BaseController;

class Controller extends BaseController
{
    //

    public function success($data = [], $code = 1, $info = 'success',  $headers = [], $status = 200)
    {
        $data = [
            'code' => $code,
            'info' => $info,
            'data' => $data,
        ];
        return response($data, $status, $headers);
    }

    public function error($data = [], $code = 0, $info = 'fail',  $headers = [], $status = 200)
    {
        $data = [
            'code' => $code,
            'info' => $info,
            'data' => $data,
        ];
        return response($data, $status, $headers);
    }

}
